package devbureau.fstore.common;

import devbureau.fstore.common.report.Bill;
import java.util.Date;
import java.util.List;

public interface Store{

    Integer importDelivery(String login, byte[] fileData, String fileName, Double rate, String currency) throws Exception;
    List<DeliveryData> listDeliveries() throws Exception;
    DeliveryData getDelivery(Integer id) throws Exception;
    List<ItemData> listItems(StoreItemFilter filter,StoreItemOrder order)  throws Exception;

    /**
     * Внимание методот каскадно удаляет OrderLine, сами Order не трогает
     *
     * @param itemId - номер позиции на складе
     * @throws java.lang.Exception
     */
    void deleteItem(Integer itemId) throws Exception;

    Date listItemsModified() throws Exception;


    /**Creates order with status_id = 0
     * User can have only one order with status 0
     */
	Integer makeOrder(Order order, String login) throws Exception;
    Integer makeOrder(Integer orderId, String login) throws Exception;

    void updateOrderLine(Integer lineId,Double priceRUR,Integer quantity) throws Exception;
    void deleteOrderLine(Integer lineId) throws Exception;
    void deleteOrder(Integer orderId) throws Exception;
    
    /**
     *
     * @param line Позиция заказа
     * @return номер созданой позиции заказа
     * @throws java.lang.Exception
     */
    Integer addOrderLine(Integer orderId,OrderLine line) throws Exception;

    List<OrderData> listOrders(String login, List<Integer> orderStatus, Date from, Date to) throws Exception;
    
    OrderData getOrder(Integer orderId) throws Exception;
    Integer updateOrder(Integer orderId, Integer newCustomerId) throws Exception;
    void updateOrderStatus(Integer orderId,OrderStatus status) throws Exception;

    Integer getOrderIdByOrderLineId(Integer orderLineId);

    Integer getActiveOrderId(String login);

    List<String> listSuppliers(StoreItemFilter filter) throws Exception;
    List<Bill> getBillReport(Date from, Date to) throws Exception;

    public List<Pair<Integer,String>> getAjaxCustomers(String partialLabel) throws Exception;
    public void deleteDelivery(Integer deliveryId) throws Exception;

    public void translate() throws Exception;
    public void importTranslation(byte[] fileData, String fileName) throws Exception;

    public List<TranslatorItem> listTranslatorItems() throws Exception;
    public void deleteTranslatorItems(List<TranslatorItem> items) throws Exception;
    public void insertTranslatorItems(List<TranslatorItem> items) throws Exception;

    public List<ItemData> getBalanceReport() throws Exception;

    public List<ItemWriteOffData> listItemWriteOfDataByDelivery(Integer deliveryId) throws Exception;
}
